{% extends 'base.html' %}
{% block header %}
<script type="text/javascript">
    $(function () {
        var count = 0;
        $('#add_cart').on("click", function () {
            count += 1;
            $('#show_count').text(count);

        })
    })
</script>
{% endblock %}
{% block body %}

	<div class="navbar_con">
		<div class="navbar clearfix">
			<div class="subnav_con fl">
				<h1>全部商品分类</h1>
				<span></span>
				<ul class="subnav">
					<li><a href="/goods/list1_1_1" class="fruit">新鲜水果</a></li>
					<li><a href="/goods/list2_1_1" class="seafood">海鲜水产</a></li>
					<li><a href="/goods/list3_1_1" class="meet">猪牛羊肉</a></li>
					<li><a href="/goods/list4_1_1" class="egg">禽类蛋品</a></li>
					<li><a href="/goods/list5_1_1" class="vegetables">新鲜蔬菜</a></li>
					<li><a href="/goods/list6_1_1" class="ice">速冻食品</a></li>
				</ul>
			</div>
			<ul class="navlist fl">
				<li><a href="/goods/index/">首页</a></li>
				<li class="interval">|</li>
				<li><a href="">手机生鲜</a></li>
				<li class="interval">|</li>
				<li><a href="">抽奖</a></li>
			</ul>
		</div>
	</div>

	<div class="breadcrumb">
		<a href="/goods/index/">全部分类</a>
		<span>></span>
		<a href="#">{{ typeinfo.type_name }}</a>
	</div>

	<div class="main_wrap clearfix">
		<div class="l_wrap fl clearfix">
			<div class="new_goods">
				<h3>新品推荐</h3>
				<ul>
                    {% for goods in new_goods %}
					<li>
						<a href="/goods/detail_{{ typeinfo.id }}_{{ goods.id }}/"><img src="/static/{{ goods.goods_picture }}"></a>
						<h4><a href="/goods/detail_{{ goods.id }}/">{{ goods.goods_name }}</a></h4>
						<div class="prize">￥{{ goods.goods_price }}</div>
					</li>
                    {% endfor %}
				</ul>
			</div>
		</div>

		<div class="r_wrap fr clearfix">
			<div class="sort_bar">
				<a href="/goods/list{{typeinfo.id}}_1_1/"
                {% if sort == "1" %}
                class="active"
                {% endif %}
				>默认</a>
				<a href="/goods/list{{typeinfo.id}}_2_1/"
                {% if sort == "2" %}
                class="active"
                {% endif %}
				>价格</a>
				<a href="/goods/list{{typeinfo.id}}_3_1/"
                {% if sort == "3" %}
                class="active"
                {% endif %}
				>人气</a>
			</div>

			<ul class="goods_type_list clearfix">
                {% for goods in page %}
				<li>
					<a href="/goods/detail{{ typeinfo.id }}_{{ goods.id }}/"><img src="/static/{{ goods.goods_picture }}"></a>
					<h4><a href="/goods/detail{{ typeinfo.id }}_{{ goods.id }}/">{{ goods.goods_name }}</a></h4>
					<div class="operate">
						<span class="prize">￥{{ goods.goods_price }}</span>
						<span class="unit">{{ goods.goods_price }}/500g</span>
						<a href="/cart/add_{{goods.id}}_1/" class="add_goods" id="add_cart" title="加入购物车"></a>
					</div>
				</li>
                {% endfor %}
			</ul>

			<div class="pagenation">
				{% if page.has_previous %}
				<a href="/goods/list{{typeinfo.id}}_{{sort}}_{{page.previous_page_number}}/">&lt;上一页</a>
				{% endif %}

				{% for index in paginator.page_range %}
                    {% if index %}
                        {% ifequal index page.number %}
                            <a href="#" class="active">{{ index }}</a>
                        {% else %}
                            <a href="/goods/list{{typeinfo.id}}_{{sort}}_{{index}}/">{{ index }}</a>
                        {% endifequal %}
                    {% else %}
                        <a>...</a>
                    {% endif %}
				{% endfor%}

				{% if page.has_next %}
				<a href="/goods/list{{typeinfo.id}}_{{sort}}_{{page.next_page_number}}/">下一页&gt;</a>
				{% endif %}
			</div>
		</div>
	</div>
{% endblock body %}

